home *** CD-ROM | disk | FTP | other *** search
/ Winzipper / Winzipper_ISO.iso / internet / net commander 1.0 / ISP / SCRPTLST / CYCOR.CMD < prev    next >
Encoding:
Text File  |  1996-03-01  |  8.6 KB  |  349 lines

  1. #**********************************************************************
  2. #
  3. # LOGIN.CMD     v4.0
  4. #
  5. # Dialing Script for Trumpet Winsock
  6. #
  7. # Copyright (c) 1995 Cycor Communications Inc.
  8. #
  9. # Serial #07059502
  10. #
  11. #**********************************************************************
  12.  
  13. #trace on                                     # if debugging
  14. echo off
  15.  
  16.                               # VARIABLE DEFINITIONS
  17. $datemade  = "11-13-1995 16:52:11"
  18. $number   = "416-350-3579"
  19. $d_prefix = ""
  20. $service  = "3"
  21. $resetstr = "AT"
  22. $initstr  = "AT&D2&C1X4Q0V1"
  23. $user     = "cycor"
  24. $result   = "cycor"
  25. $result1  = "cycor"
  26. $result2  = "cycor"
  27. %maxTries = 4
  28. %n        = 0
  29. %n        = 0
  30. %success  = 0
  31.  
  32.  
  33. #
  34. # READ VARIABLES FROM TRUMPSWK.INI
  35. #
  36.                               # ATTEMPT TO LOAD USER INFORMATION
  37. if ![load $user]
  38.      save $user 
  39.  
  40. end
  41.  
  42. #
  43. # RESET MODEM
  44. #
  45.                               # CHECK MODEM
  46. %n = %maxTries
  47. display \n
  48. display \n
  49. display "Resetting modem.."
  50. repeat
  51.      display "."
  52.      output  $resetstr\13
  53.      %n = %n - 1
  54.      if [input 5 OK\n]
  55.           %success = 1
  56.      else
  57.           %success = 0
  58.  
  59.      end
  60.  
  61. until %success | %n < 1
  62.  
  63.                               # MODEM RESET OK
  64. if %success
  65.      sleep 5
  66.      display "Done."\n
  67.                               # MODEM FAILED TO RESET
  68. else
  69.      display \007\n
  70.      display "Modem failed to reset properly."\n
  71.      display "Ensure your setup SLIP PORT is the correct COM port for your modem."\n
  72.      display \n
  73.      abort
  74.  
  75. end
  76.  
  77.  
  78. #
  79. # INITIALIZE MODEM
  80. #
  81.                               # CHECK MODEM
  82. %n = %maxTries
  83. display "Initializing modem.."
  84. repeat
  85.      display "."
  86.      output  $initstr\13
  87.      %n = %n - 1
  88.      if [input 3 OK\n]
  89.           %success = 1
  90.      else
  91.           %success = 0
  92.  
  93.      end
  94.  
  95. until %success | %n < 1
  96.  
  97.                               # MODEM INITIALIZED OK
  98. if %success
  99.      sleep 1
  100.      display "Done."\n
  101.                               # MODEM FAILED TO INITIALIZE
  102. else
  103.      display \007\n
  104.      display "Modem failed to initialize properly."\n
  105.      display "Ensure your setup SLIP PORT is the correct COM port for your modem."\n
  106.      display \n
  107.      abort
  108.  
  109. end
  110.  
  111.  
  112. #
  113. # ATTEMPT TO DIAL
  114. #
  115.  
  116. %n = %maxTries
  117. %success = 0
  118. display "Dialing Cycor Communications..." \n
  119.  
  120. repeat
  121.      display "Dialing..."$d_prefix$number \n
  122.      output "atdt" $d_prefix $number \13
  123.  
  124.                               # DECREMENT ATTEMPT COUNTER
  125.      %n = %n - 1
  126.  
  127.                               # CLEAR INPUT STREAM
  128.      %timeout = [read 2 $result2]
  129.  
  130.                               # PICK UP DIAL CODE
  131.      %timeout = [read 5 $result2]
  132.  
  133.                               # PICK UP SHORT-TMO ERRORS
  134.      %timeout = [read 20 $result1]
  135.  
  136.                               # PICK UP LONG-TMO ERRORS
  137.      %timeout = [read 60 $result]
  138.  
  139.                               # CONCAT INPUT STREAMS
  140.      $result = $result + $result1 + $result2
  141.  
  142.      if pos("NO DIAL", $result) > 0
  143.           display "No dial tone - is modem connected properly?" \n
  144.           display "Waiting 25 seconds to retry..." \n
  145.           sleep 25
  146.  
  147.       else
  148.           if pos("CARRIER", $result) > 0
  149.                display "No carrier - is phone number correct?" \n
  150.                display "Waiting 25 seconds to retry..." \n
  151.                sleep 25
  152.  
  153.           else
  154.  
  155.                if pos("BUSY", $result) > 0
  156.                     display "All lines are busy..." \n
  157.                     display "If this situation persists, please report it to "\n
  158.                     display "Cycor's Technical Support @ 1-(800)-AT-CYCOR."\n
  159.                     display "Waiting 25 seconds to retry..." \n
  160.                     sleep 25
  161.  
  162.                else
  163.                     if pos("CONNECT", $result) > 0
  164.                          %success = 1
  165.  
  166.                     else
  167.                              # AN UNKNOWN ERROR OCCURRED
  168.                          %success = 0
  169.                          display "Could not properly connect... " \n
  170.                          display "Waiting 25 seconds to retry..." \n
  171.                          sleep 25
  172.  
  173.                     end
  174.  
  175.                end
  176.  
  177.           end
  178.  
  179.      end
  180.  
  181. until %n < 1 | %success
  182.  
  183.                               # DIAL ATTEMPT(S) SUCCESSFUL
  184. if %success = 1
  185.      display "Connected."\n
  186.  
  187.                               # DIAL ATTEMPT(S) FAILED
  188. else
  189.      display \007\n
  190.      display "Connection NOT established. Perhaps all lines are busy?"\n
  191.      display "Try again in a few minutes."\n
  192.      abort
  193.  
  194. end
  195.  
  196.  
  197. #
  198. # CONNECT TO ANNEX
  199. #
  200.                               # CONNECT TO ANNEX
  201. %n = %maxTries
  202. %n1 = %maxTries
  203. display "Establishing connection with Annex..."
  204. repeat
  205.      repeat
  206.           %success = [input 15 choice:]
  207.           %n = %n - 1
  208.      until %success | %n < 1
  209.  
  210.                               # ANNEX CONNECTION SUCCESSFUL
  211.      if %success
  212.           output $service\13
  213.  
  214.                               # ANNEX CONNECTION FAILED
  215.      else
  216.           display \007\n
  217.           display "Could not log into Annex."\n
  218.           display "The system may be temporarily down."\n
  219.           display "Please try again in a few moments..."\n
  220.           abort
  221.  
  222.      end
  223.  
  224.                               # ATTEMPT TO LOG IN
  225.      if %success
  226.           %success = 0
  227.           %n1 = %n1 - 1
  228.           input    10 Username:
  229.           query    $user "Please enter your Cycor user id"
  230.           output   $user\13
  231.           password "Password for user "$user
  232.           output   \p\13
  233.  
  234.           %timeout = [read 5 $result2]
  235.           %timeout = [read 5 $result1]
  236.           %timeout = [read 5 $result]
  237.  
  238.           $result = $result + $result1 + $result2
  239.  
  240.           if pos("CLI", $result)
  241.                display \007\n
  242.                display "Permission denied... Your Username or password was entered incorrectly." \n
  243.  
  244.           else
  245.                %success = 1
  246.                display \n
  247.                display "You are now online!!!" \n
  248.                display "Now minimize this application and the other Cycor"\n
  249.                display "Internet applications are avaiable for you."\n
  250.                display \n
  251.                display "When you wish to log off, return to this application"\n
  252.                display "and choose 'Bye' from the Dialer menu."\n
  253.                display \n
  254.  
  255.           end
  256.  
  257.      else
  258.                               # ANNEX CONNECTION FAILED
  259.           if %n < 1
  260.                %n1 = 0
  261.  
  262.           end
  263.  
  264.      end
  265.  
  266. until %success | %n1 < 1
  267.  
  268.                               # COULD NOT LOG IN CORRECTLY
  269. if %success
  270.      display "Online." \n
  271.  
  272. else
  273.      display \007\n
  274.      display "Could not log in. Please try again." \n
  275.      display "If you continue to experience difficulties getting connected,"\n
  276.      display "contact Cycor's Techical Support @ 1-(800)-AT-CYCOR."\n
  277.      abort
  278.  
  279. end
  280.  
  281.  
  282.  
  283. #
  284. # GO ONLINE
  285. #
  286.  
  287. if $service = "3"
  288.                               # PPP Server
  289.      online
  290.      display \007\n
  291.      display "Online."\n
  292.      display \n
  293.  
  294. else
  295.      if $service = "2"
  296.                               # SLIP SERVER
  297.           if [input 45 Your]
  298.                               # OBTAINED DYNAMIC IP ADDRESS
  299.                if [address 15]
  300.                     online
  301.  
  302.                     display \007\n
  303.                     display "Your IP address is "\I\n
  304.                     display "Online."\n
  305.                     display \n
  306.  
  307.                               # COULD NOT OBTAIN DYNAMIC IP ADDRESS
  308.                else
  309.                     display \007\n
  310.                     display "Error: Could not obtain IP address from server."\n
  311.                     display "If you continue to experience difficulties getting connected,"\n
  312.                     display "contact Cycor's Techical Support @ 1-(800)-AT-CYCOR."\n
  313.                     display \n
  314.                     abort
  315.  
  316.                end
  317.  
  318.           else
  319.                               # NO RESPONSE FROM ANNEX
  320.                display \007\n
  321.                display "Error: No reponse from Annex."\n
  322.                display "The system may be down. If this problem persists,"\n
  323.                display "Please report this to Cycor's Technical Support"\n
  324.                display "line @ 1-(800)-AT-CYCOR."\n
  325.                display \n
  326.                abort
  327.  
  328.           end
  329.  
  330.                               # INVALID SERVICE TYPE
  331.      else
  332.           display \007\n
  333.           display "Error: An invalid service type was selected."\n
  334.           display "Please re-install this package or contact Cycor"\n
  335.           display "Technical Support @ 1-(800)-AT-CYCOR."\n
  336.           display \n
  337.           abort
  338.  
  339.      end
  340.  
  341. end
  342.  
  343.  
  344. #
  345. #  SAVE VARIABLES TO TRMPSWK.INI
  346. #
  347. save $user
  348.  
  349.